package hn.cch.grammar.gc;

/**
 * 引用计数
 */
public class ReferenceCountDemo {

    private Object instance;

    public ReferenceCountDemo() {
        byte[] data = new byte[1024];
    }

    /**
     * 引用计数
     * -verbose:gc -XX:+PrintGCDetails
     *
     * @param args
     */
    public static void main(String[] args) {
        ReferenceCountDemo referenceCountDemo0 = new ReferenceCountDemo();
        ReferenceCountDemo referenceCountDemo1 = new ReferenceCountDemo();

        referenceCountDemo0.instance = referenceCountDemo1;
        referenceCountDemo1.instance = referenceCountDemo0;

        referenceCountDemo0 = null;
        referenceCountDemo1 = null;

        System.gc();

    }
}
